package com.rs.controller.Rs;

import java.awt.Font;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import java.awt.event.MouseAdapter;
import java.awt.event.MouseEvent;
import java.beans.PropertyVetoException;
import java.util.Enumeration;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.Optional;

import javax.swing.AbstractButton;
import javax.swing.ButtonGroup;
import javax.swing.JButton;
import javax.swing.JComboBox;
import javax.swing.JDesktopPane;
import javax.swing.JDialog;
import javax.swing.JInternalFrame;
import javax.swing.JLabel;
import javax.swing.JOptionPane;
import javax.swing.JPanel;
import javax.swing.JRadioButton;
import javax.swing.JTable;
import javax.swing.JTextArea;
import javax.swing.JTextField;
import javax.swing.ListSelectionModel;
import javax.swing.table.DefaultTableModel;

import com.rs.model.CommonResult;
import com.rs.model.Reimburse;
import com.rs.model.Reimbursetype;
import com.rs.model.rs.User;
import com.rs.service.rs.ReimburseService;
import com.rs.service.rs.ReimburseTypeeService;
import com.rs.util.DateChooser;
import com.rs.util.ImagePanel;
import com.rs.util.SpringContextUtils;
import com.rs.util.TimeTypeConversionUtil;

public class ReimJFame extends JInternalFrame {

	private static final long serialVersionUID = 1L;

	public ReimJFame() {
		super();
		//设置是否允许自由调整大小
		setResizable(true);

		//设置是否提供“最大化”按钮
		setMaximizable(true);

		//设置是否提供“最小化”按钮
		setIconifiable(true);

		//设置是否提供关闭按钮
		setClosable(true);
		getContentPane().setLayout(null);

		setVisible(true);
	}

	public void alert(String alert) {
		JOptionPane.showMessageDialog(this, alert);

	}

	class selectJFame extends ReimJFame {

		private static final long serialVersionUID = 1L;

		private ReimburseService rei = SpringContextUtils.getBean(ReimburseService.class);

		private ReimburseTypeeService ret = SpringContextUtils.getBean(ReimburseTypeeService.class);

		private Reimburse reimburse = new Reimburse();

		private JPanel contentPane;

		private JTable table;

		// 表头（列名）
		private Object[] columnNames = { "ID", "员工姓名", "报销类别", "报销金额", "报销日期", "审核状态", "操作", "操作" };

		private DefaultTableModel dtable;

		private JLabel show;//显示分页

		private Integer pageNum;//当前页

		private Integer pages;//总页数

		private JComboBox<String> type;//报销类别

		private JTextField ktime;//开始时间

		private JTextField jtime;//结束时间

		private JComboBox<String> ittype;//审核状态

		private Map<String, Integer> maptype = new HashMap<>();

		public selectJFame(final JDesktopPane q, final User user) {
			super();
			//设置标题
			setTitle("项目记录");
			//设置是否允许自由调整大小
			setResizable(false);
			//设置最大化
			setMaximizable(false);
			//设置大小
			setBounds(40, 35, 800, 550);
			//主体
			contentPane = new ImagePanel(800, 550, "twwe2.jpg");
			contentPane.setLayout(null);
			setContentPane(contentPane);

			//创建1个字体实例
			Font font = new Font("宋体", Font.BOLD, 14);
			//初始化当前页数为
			reimburse.setPageNum(1);
			//查询所有的
			CommonResult<Map<String, Object>> reimburses = rei.reimburseAllPC(reimburse);

			//为当前页赋值
			if (Optional.ofNullable(reimburses.getData().get("pageNum")).isPresent()) {

				pageNum = (Integer) reimburses.getData().get("pageNum");
			} else {
				pageNum = 1;
			}

			//总页数
			if (Optional.ofNullable(reimburses.getData().get("pages")).isPresent()) {
				pages = (Integer) reimburses.getData().get("pages");
			} else {
				pages = 1;
			}
			//转为list
			// 创建一个表格，指定 所有行数据 和 表头
			dtable = new DefaultTableModel(getObjectArys(reimburses), columnNames);

			table = new JTable(dtable) {
				private static final long serialVersionUID = 1L;

				//设置表格为不可编辑
				@Override
				public boolean isCellEditable(int row, int column) {
					return false;
				}
			};
			//设置行高
			table.setRowHeight(25);
			table.setFont(font);
			table.getTableHeader().setBounds(20, 90, 750, 25);
			table.setBounds(20, 120, 750, 300);
			//表头不可拖动
			table.getTableHeader().setReorderingAllowed(false);
			//设置是否可以选择此模型中的行。 
			table.setRowSelectionAllowed(true);
			//设置表格为不可编辑
			//table.isCellEditable(uList.size(), 6);
			//设置只能选择一行
			table.setSelectionMode(ListSelectionModel.SINGLE_SELECTION);

			// 把 表头 添加到容器顶部（使用普通的中间容器添加表格时，表头 和 内容 需要分开添加）
			contentPane.add(table.getTableHeader(), null);
			// 把 表格内容 添加到容器中心
			contentPane.add(table, null);

			//表格的点击事件

			table.addMouseListener(new MouseAdapter() {

				@Override
				public void mouseClicked(MouseEvent e) {
					if (e.getClickCount() == 2) {
						boolean flag = true;
						// 处理鼠标双击
						//所选的行数
						int row = table.getSelectedRow();
						//所选的列数
						int column = table.columnAtPoint(e.getPoint());
						String pId = table.getValueAt(row, 0).toString(); //得到所在行的第一个列的值，作为下面事件传递的参数

						//得到单元格的内容
						Object valueAt = table.getValueAt(row, column);
						switch ((String) valueAt) {
						case "审核":

							q.add(new ReimJFame().new AuditReimJFame(pId, q, user));
							flag = true;
							break;
						case "查看":
							q.add(new ReimJFame().new LookReinJFame(pId, q));
							flag = true;
							break;
						default:
							q.add(new ReimJFame().new LookReinJFame(pId, q));
							flag = true;
							break;
						}
						try {
							//使窗口图标化
							setIcon(flag);
						} catch (PropertyVetoException e1) {

							e1.printStackTrace();
						}
					}
				}

			});

			//分页

			show = new JLabel();
			show.setText("当前页：" + pageNum + " / 总页数：" + pages);
			show.setFont(new Font("宋体", Font.BOLD, 15));
			show.setBounds(300, 420, 200, 30);
			contentPane.add(show, null);

			final JButton fore = new JButton("首  页");
			fore.setBounds(100, 475, 80, 28);
			fore.setFont(font);
			contentPane.add(fore, null);
			fore.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					String type = fore.getText();
					paging(type);

				}
			});

			final JButton previous = new JButton("上一页");
			previous.setBounds(280, 475, 80, 28);
			previous.setFont(font);
			contentPane.add(previous, null);
			previous.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					String type = previous.getText();
					paging(type);
				}
			});

			final JButton later = new JButton("下一页");
			later.setBounds(470, 475, 80, 28);
			later.setFont(font);
			contentPane.add(later, null);
			later.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					String type = later.getText();
					paging(type);

				}
			});

			final JButton aft = new JButton("尾  页");
			aft.setBounds(630, 475, 80, 28);
			aft.setFont(font);
			contentPane.add(aft, null);
			aft.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					String type = aft.getText();
					paging(type);

				}
			});

			ret.selectReimbursetypeAll();
			type = new JComboBox<String>();
			type.setBounds(20, 10, 90, 20);
			type.setFont(font);
			type.addItem("报销类别");
			contentPane.add(type);

			List<Reimbursetype> list = ret.selectReimbursetypeAll();
			for (Reimbursetype reimbursetype : list) {
				type.addItem(reimbursetype.getRety_name());
				maptype.put(reimbursetype.getRety_name(), reimbursetype.getRety_id());
			}

			//审核
			String[] audytArr = new String[] { "审核状态", "待审核", "通过", "驳回" };
			ittype = new JComboBox<String>(audytArr);
			ittype.setBounds(140, 10, 90, 20);
			ittype.setFont(font);
			contentPane.add(ittype);

			JLabel time = new JLabel("报销日期:");
			time.setFont(font);
			time.setBounds(280, 10, 90, 20);

			contentPane.add(time);

			//开始时间
			ktime = new JTextField();
			ktime.setBounds(380, 10, 90, 20);
			ktime.setFont(font);
			ktime.setColumns(10);
			ktime.setText("开始时间");
			//禁止编辑
			ktime.setEditable(false);

			contentPane.add(ktime);
			//添加鼠标监听事件
			ktime.addMouseListener(new MouseAdapter() {
				//鼠标点击事件
				@Override
				public void mouseClicked(MouseEvent e) {
					final JDialog jDialog = new JDialog();//对话框
					jDialog.setBounds(500, 200, 350, 350);
					jDialog.setResizable(false);
					final DateChooser datePicker = new DateChooser();
					datePicker.addActionListener(new ActionListener() {// 事件捕获
						@Override
						public void actionPerformed(ActionEvent e) {
							String time = datePicker.getSelectedDate();
							ktime.setText(time);
							jDialog.dispose();
						}
					});

					jDialog.getContentPane().add(datePicker);
					jDialog.setVisible(true);

				}
			});

			//结束时间
			jtime = new JTextField();
			jtime.setBounds(500, 10, 90, 20);
			jtime.setFont(font);
			jtime.setColumns(10);
			jtime.setText("结束时间");
			//禁止编辑
			jtime.setEditable(false);

			contentPane.add(jtime);
			//添加鼠标监听事件
			jtime.addMouseListener(new MouseAdapter() {
				//鼠标点击事件
				@Override
				public void mouseClicked(MouseEvent e) {
					final JDialog jDialog = new JDialog();//对话框
					jDialog.setBounds(500, 200, 350, 350);
					jDialog.setResizable(false);
					final DateChooser datePicker = new DateChooser();
					datePicker.addActionListener(new ActionListener() {// 事件捕获
						@Override
						public void actionPerformed(ActionEvent e) {
							String time = datePicker.getSelectedDate();
							jtime.setText(time);
							jDialog.dispose();
						}
					});

					jDialog.getContentPane().add(datePicker);
					jDialog.setVisible(true);

				}
			});

			//查询按钮
			JButton query = new JButton("查询");
			query.setBounds(620, 10, 70, 20);
			query.setFont(font);
			contentPane.add(query);
			query.addActionListener(new ActionListener() {

				@Override
				public void actionPerformed(ActionEvent e) {

					if (!ktime.getText().equals("开始时间") && !jtime.getText().equals("结束时间")) {
						reimburse.setStartTime(TimeTypeConversionUtil.getDateByString(ktime.getText()));
						reimburse.setEndTime(TimeTypeConversionUtil.getDateByString(jtime.getText()));
					}

					//报销类别
					String retype = (String) type.getSelectedItem();
					if (!retype.equals("报销类别")) {
						reimburse.setRe_tyid(maptype.get(retype));
					}
					//审核状态
					String auditString = (String) ittype.getSelectedItem();
					if (!auditString.equals("审核状态")) {
						switch (auditString) {
						case "待审核":
							reimburse.setRe_audit(0);
							break;
						case "通过":
							reimburse.setRe_audit(1);
							break;
						case "驳回":
							reimburse.setRe_audit(2);
						}
					}

					//查询
					//设置当前页为1
					reimburse.setPageNum(1);
					CommonResult<Map<String, Object>> result = rei.reimburseAllPC(reimburse);
					Object[][] shouye = getObjectArys(result);
					//使用数组 dataVector的值替换 dataVector实例变量中的值。 
					dtable.setDataVector(shouye, columnNames);
					table.setModel(dtable);
					pageNum = (Integer) result.getData().get("pageNum");
					pages = (Integer) result.getData().get("pages");
					show.setText("当前页：" + pageNum + " / 总页数：" + pages);

				}
			});

			//重置按钮
			JButton reset = new JButton("重置");
			reset.setBounds(700, 10, 70, 20);
			reset.setFont(font);
			contentPane.add(reset);
			reset.addActionListener(new ActionListener() {

				@Override
				public void actionPerformed(ActionEvent e) {
					//重置
					reset();
				}
			});

			//刷新
			JButton refresh = new JButton("刷新");
			refresh.setBounds(620, 40, 70, 20);
			refresh.setFont(font);
			contentPane.add(refresh);
			refresh.addActionListener(new ActionListener() {

				@Override
				public void actionPerformed(ActionEvent e) {
					//查询
					//设置当前页为1
					reimburse.setPageNum(1);
					CommonResult<Map<String, Object>> result = rei.reimburseAllPC(reimburse);
					Object[][] shouye = getObjectArys(result);
					//使用数组 dataVector的值替换 dataVector实例变量中的值。 
					dtable.setDataVector(shouye, columnNames);
					table.setModel(dtable);
					pageNum = (Integer) result.getData().get("pageNum");
					pages = (Integer) result.getData().get("pages");
					show.setText("当前页：" + pageNum + " / 总页数：" + pages);
				}
			});

		}

		public void paging(String type) {
			switch (type) {
			case "首  页":
				reimburse.setPageNum(1);
				CommonResult<Map<String, Object>> ufore = rei.reimburseAllPC(reimburse);
				Object[][] shouye = getObjectArys(ufore);
				//使用数组 dataVector的值替换 dataVector实例变量中的值。 
				dtable.setDataVector(shouye, columnNames);
				table.setModel(dtable);
				pageNum = (Integer) ufore.getData().get("pageNum");
				pages = (Integer) ufore.getData().get("pages");
				show.setText("当前页：" + pageNum + " / 总页数：" + pages);
				break;
			case "上一页":
				//当前页减1
				int previousNum = pageNum - 1;
				if (previousNum < 1) {
					alert("当前已是首页");
					previousNum = 1;
				}
				reimburse.setPageNum(previousNum);
				CommonResult<Map<String, Object>> upreviou = rei.reimburseAllPC(reimburse);
				Object[][] shangyi = getObjectArys(upreviou);

				//使用数组 dataVector的值替换 dataVector实例变量中的值。 
				dtable.setDataVector(shangyi, columnNames);
				table.setModel(dtable);
				pageNum = (Integer) upreviou.getData().get("pageNum");
				pages = (Integer) upreviou.getData().get("pages");
				show.setText("当前页：" + pageNum + " / 总页数：" + pages);

				break;
			case "下一页":
				//当前页加1
				int laterNum = pageNum + 1;

				if (laterNum > pages) {
					alert("当前已是尾页");
					laterNum = pages;
				}

				reimburse.setPageNum(laterNum);
				CommonResult<Map<String, Object>> ulater = rei.reimburseAllPC(reimburse);

				Object[][] xiayiye = getObjectArys(ulater);

				//使用数组 dataVector的值替换 dataVector实例变量中的值。 
				dtable.setDataVector(xiayiye, columnNames);
				table.setModel(dtable);
				pageNum = (Integer) ulater.getData().get("pageNum");
				pages = (Integer) ulater.getData().get("pages");
				show.setText("当前页：" + pageNum + " / 总页数：" + pages);
				break;
			case "尾  页":
				reimburse.setPageNum(pages);
				CommonResult<Map<String, Object>> uaft = rei.reimburseAllPC(reimburse);
				Object[][] weiye = getObjectArys(uaft);
				//使用数组 dataVector的值替换 dataVector实例变量中的值。 
				dtable.setDataVector(weiye, columnNames);
				table.setModel(dtable);
				pageNum = (Integer) uaft.getData().get("pageNum");
				pages = (Integer) uaft.getData().get("pages");
				show.setText("当前页：" + pageNum + " / 总页数：" + pages);
				break;
			}
		}

		public Object[][] getObjectArys(CommonResult<Map<String, Object>> reimburses) {
			@SuppressWarnings("unchecked")
			List<Reimburse> pList = (List<Reimburse>) reimburses.getData().get("list");

			Object[][] rowData = new Object[pList.size()][];
			for (int i = 0, n = pList.size(); i < n; i++) {
				Reimburse reimburse = pList.get(i);
				rowData[i] = reimburse.toObjects(columnNames.length);
			}
			return rowData;
		}

		//重置
		public void reset() {

			type.setSelectedIndex(0);
			ittype.setSelectedIndex(0);

			ktime.setText("开始时间");

			jtime.setText("结束时间");

			reimburse.setRe_audit(null);
			reimburse.setRe_tyid(null);
		}

	}

	/**
	 * 审核
	 */
	class AuditReimJFame extends ReimJFame {

		private static final long serialVersionUID = 1L;

		private ReimburseService rei = SpringContextUtils.getBean(ReimburseService.class);

		private JPanel contentPane;

		private JTextField text_id;//id

		private JTextField text_uname;//员工姓名

		private JTextField text_tname;//报销类别名称

		private JTextField text_money;//报销金额

		private JTextField text_time;//报销日期		

		private JTextArea text_reason;//报销详细

		public AuditReimJFame(final String pid, JDesktopPane q, final User user) {
			super();
			//使窗体只有一个界面
			JInternalFrame[] jif = q.getAllFrames();
			if (jif.length >= 2) {
				jif[0].dispose();
			}
			//设置标题
			setTitle("审核报销");
			//设置是否允许自由调整大小
			setResizable(false);
			//设置最大化
			setMaximizable(false);
			//设置大小
			setBounds(150, 15, 580, 600);

			contentPane = new ImagePanel(580, 600, "twwe2.jpg");
			contentPane.setLayout(null);
			setContentPane(contentPane);

			//创建1个字体实例
			Font font = new Font("宋体", Font.BOLD, 15);

			//查询
			Reimburse reimburse = rei.reimburseByIdPC(Integer.valueOf(pid));

			//姓名
			JLabel uname = new JLabel("员工姓名:");
			uname.setFont(font);
			uname.setBounds(50, 30, 75, 20);
			text_uname = new JTextField(reimburse.getRe_uname());
			text_uname.setFont(font);
			text_uname.setBounds(130, 30, 80, 20);
			//禁止编辑
			text_uname.setEditable(false);
			contentPane.add(uname);
			contentPane.add(text_uname);

			//id
			JLabel id = new JLabel("报销id:");
			id.setFont(font);
			id.setBounds(50, 70, 75, 20);
			text_id = new JTextField(String.valueOf(reimburse.getRe_id()));
			text_id.setFont(font);
			text_id.setBounds(130, 70, 80, 20);
			//禁止编辑
			text_id.setEditable(false);
			contentPane.add(id);
			contentPane.add(text_id);

			//报销类别
			JLabel tname = new JLabel("报销类别:");
			tname.setFont(font);
			tname.setBounds(50, 120, 75, 20);
			text_tname = new JTextField(reimburse.getRe_tname());
			text_tname.setFont(font);
			text_tname.setBounds(130, 120, 80, 20);
			//禁止编辑
			text_tname.setEditable(false);
			contentPane.add(tname);
			contentPane.add(text_tname);

			//报销金额
			JLabel money = new JLabel("报销金额:");
			money.setFont(font);
			money.setBounds(50, 170, 75, 20);
			text_money = new JTextField(String.valueOf(reimburse.getRe_money()) + "元");
			text_money.setFont(font);
			text_money.setBounds(130, 170, 80, 20);
			//禁止编辑
			text_money.setEditable(false);
			contentPane.add(money);
			contentPane.add(text_money);

			//报销日期
			JLabel time = new JLabel("报销日期:");
			time.setFont(font);
			time.setBounds(300, 30, 75, 20);
			text_time = new JTextField(TimeTypeConversionUtil.getStringDate(reimburse.getRe_time()));
			text_time.setFont(font);
			text_time.setBounds(380, 30, 100, 20);
			//禁止编辑
			text_time.setEditable(false);
			contentPane.add(time);
			contentPane.add(text_time);

			//领用详情
			JLabel reason = new JLabel("报销明细:");
			reason.setFont(font);
			reason.setBounds(300, 70, 75, 20);
			text_reason = new JTextArea(reimburse.getRe_reason());
			text_reason.setFont(font);
			text_reason.setBounds(300, 100, 180, 90);
			//禁止编辑
			text_reason.setEditable(false);
			contentPane.add(reason);
			contentPane.add(text_reason);

			//审核
			final ButtonGroup bg = new ButtonGroup(); //创建单选按钮组

			JLabel through = new JLabel("通过:");
			through.setFont(font);
			through.setBounds(160, 220, 75, 20);
			//创建单选按钮
			JRadioButton but1 = new JRadioButton("1"); //创建单选按钮
			but1.setBounds(210, 220, 20, 20);
			//如果此组件应该是不透明的，则为true 
			but1.setOpaque(false);

			JLabel rejected = new JLabel("驳回:");
			rejected.setFont(font);
			rejected.setBounds(300, 220, 75, 20);
			//创建单选按钮
			JRadioButton but2 = new JRadioButton("2"); //创建单选按钮
			but2.setBounds(350, 220, 20, 20);
			but2.setOpaque(false);

			bg.add(but1);
			bg.add(but2);

			contentPane.add(through);
			contentPane.add(but1);
			contentPane.add(rejected);
			contentPane.add(but2);

			//审核
			JButton yesButton = new JButton("审核");
			yesButton.setFont(font);
			yesButton.setBounds(160, 250, 70, 25);
			contentPane.add(yesButton);
			//监听
			yesButton.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					String type = null;
					//获得单选按钮的选中值
					Enumeration<AbstractButton> radioBtns = bg.getElements();
					while (radioBtns.hasMoreElements()) {
						AbstractButton btn = radioBtns.nextElement();
						if (btn.isSelected()) {
							type = btn.getText();
							break;
						}
					}
					if (Optional.ofNullable(type).isPresent()) {
						Reimburse r = new Reimburse();
						r.setRe_id(Integer.valueOf(pid));
						r.setRe_auid(user.getU_id());
						r.setRe_audit(Integer.valueOf(type));
						rei.reimburseUpdatePC(r);
						alert("审核成功");
						dispose();

					} else {
						alert("请选择审核状态");
					}
				}
			});

			//重置按钮
			JButton resetButton = new JButton("重置");
			resetButton.setFont(font);
			resetButton.setBounds(300, 250, 70, 25);
			contentPane.add(resetButton);
			//监听
			resetButton.addActionListener(new ActionListener() {
				@Override
				public void actionPerformed(ActionEvent e) {
					bg.clearSelection();
				}
			});

		}

	}

	/**
	 * 查看
	 */
	class LookReinJFame extends ReimJFame {
		private static final long serialVersionUID = 1L;

		private ReimburseService rei = SpringContextUtils.getBean(ReimburseService.class);

		private JPanel contentPane;

		private JTextField text_id;//id

		private JTextField text_uname;//员工姓名

		private JTextField text_tname;//报销类别名称

		private JTextField text_money;//报销金额

		private JTextField text_time;//报销日期		

		private JTextArea text_reason;//报销详细

		private JTextField text_audit;//审核状态

		private JTextField text_auname;//审核人姓名

		public LookReinJFame(String pid, JDesktopPane q) {

			super();
			//使窗体只有一个界面
			JInternalFrame[] jif = q.getAllFrames();
			if (jif.length >= 2) {
				jif[0].dispose();
			}
			//设置标题
			setTitle("报销详细");
			//设置是否允许自由调整大小
			setResizable(false);
			//设置最大化
			setMaximizable(false);
			//设置大小
			setBounds(150, 15, 580, 600);

			contentPane = new ImagePanel(580, 600, "twwe2.jpg");
			contentPane.setLayout(null);
			setContentPane(contentPane);

			//创建1个字体实例
			Font font = new Font("宋体", Font.BOLD, 15);

			//查询
			Reimburse reimburse = rei.reimburseByIdPC(Integer.valueOf(pid));

			//姓名
			JLabel uname = new JLabel("员工姓名:");
			uname.setFont(font);
			uname.setBounds(50, 30, 75, 20);
			text_uname = new JTextField(reimburse.getRe_uname());
			text_uname.setFont(font);
			text_uname.setBounds(130, 30, 80, 20);
			//禁止编辑
			text_uname.setEditable(false);
			contentPane.add(uname);
			contentPane.add(text_uname);

			//id
			JLabel id = new JLabel("报销id:");
			id.setFont(font);
			id.setBounds(50, 70, 75, 20);
			text_id = new JTextField(String.valueOf(reimburse.getRe_id()));
			text_id.setFont(font);
			text_id.setBounds(130, 70, 80, 20);
			//禁止编辑
			text_id.setEditable(false);
			contentPane.add(id);
			contentPane.add(text_id);

			//报销类别
			JLabel tname = new JLabel("报销类别:");
			tname.setFont(font);
			tname.setBounds(50, 120, 75, 20);
			text_tname = new JTextField(reimburse.getRe_tname());
			text_tname.setFont(font);
			text_tname.setBounds(130, 120, 80, 20);
			//禁止编辑
			text_tname.setEditable(false);
			contentPane.add(tname);
			contentPane.add(text_tname);

			//报销金额
			JLabel money = new JLabel("报销金额:");
			money.setFont(font);
			money.setBounds(50, 170, 75, 20);
			text_money = new JTextField(String.valueOf(reimburse.getRe_money()) + "元");
			text_money.setFont(font);
			text_money.setBounds(130, 170, 80, 20);
			//禁止编辑
			text_money.setEditable(false);
			contentPane.add(money);
			contentPane.add(text_money);

			//报销日期
			JLabel time = new JLabel("报销日期:");
			time.setFont(font);
			time.setBounds(300, 30, 75, 20);
			text_time = new JTextField(TimeTypeConversionUtil.getStringDate(reimburse.getRe_time()));
			text_time.setFont(font);
			text_time.setBounds(380, 30, 100, 20);
			//禁止编辑
			text_time.setEditable(false);
			contentPane.add(time);
			contentPane.add(text_time);

			//领用详情
			JLabel reason = new JLabel("报销明细:");
			reason.setFont(font);
			reason.setBounds(300, 70, 75, 20);
			text_reason = new JTextArea(reimburse.getRe_reason());
			text_reason.setFont(font);
			text_reason.setBounds(300, 100, 180, 90);
			//禁止编辑
			text_reason.setEditable(false);
			contentPane.add(reason);
			contentPane.add(text_reason);

			//审核状态
			JLabel audit = new JLabel("审核状态:");
			audit.setFont(font);
			audit.setBounds(50, 230, 75, 20);
			String t = null;

			switch (reimburse.getRe_audit()) {
			case 0:
				t = "待审核";
				break;

			case 1:
				t = "通过";
				break;
			case 2:
				t = "驳回";
				break;
			}
			text_audit = new JTextField(t);
			text_audit.setFont(font);
			text_audit.setBounds(130, 230, 80, 20);
			//禁止编辑
			text_audit.setEditable(false);
			contentPane.add(audit);
			contentPane.add(text_audit);

			//审核人
			JLabel auname = new JLabel("审核人:");
			auname.setFont(font);
			auname.setBounds(50, 280, 75, 20);
			text_auname = new JTextField(reimburse.getRe_auname());
			text_auname.setFont(font);
			text_auname.setBounds(130, 280, 80, 20);
			//禁止编辑
			text_auname.setEditable(false);
			contentPane.add(auname);
			contentPane.add(text_auname);

		}

	}

}
